/* 全局变量 - 支持主题切换 */
:root {
    /* 浅色主题 */
    --bg-primary: #f5f5f5;
    --bg-secondary: #ffffff;
    --bg-tertiary: #fafbfc;
    --text-primary: #333;
    --text-secondary: #2c3e50;
    --text-muted: #7f8c8d;
    --text-hint: #95a5a6;
    --border-color: #e1e5e9;
    --shadow-light: rgba(0,0,0,0.05);
    --shadow-medium: rgba(0,0,0,0.1);
    --shadow-heavy: rgba(0,0,0,0.15);
    --accent-primary: #00a651;
    --accent-secondary: #007a3d;
    --connection-color: #3498db;
    --grid-color: #ddd;
    /* 顶部工具栏颜色（浅色模式更浅的绿色） */
    --toolbar-primary: #00d66a;
    --toolbar-secondary: #00a651;
    
    /* 过渡动画 */
    --transition-fast: 0.2s ease;
    --transition-medium: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* 暗黑主题 */
[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-tertiary: #363636;
    --text-primary: #ffffff;
    --text-secondary: #e0e0e0;
    --text-muted: #b0b0b0;
    --text-hint: #888888;
    --border-color: #404040;
    --shadow-light: rgba(0,0,0,0.3);
    --shadow-medium: rgba(0,0,0,0.4);
    --shadow-heavy: rgba(0,0,0,0.5);
    --accent-primary: #00d66a;
    --accent-secondary: #00a651;
    --connection-color: #66b3ff;
    --grid-color: #444;
    /* 顶部工具栏颜色（暗色模式更深的绿色） */
    --toolbar-primary: #007a3d;
    --toolbar-secondary: #006b35;
}

/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
    transition: background-color var(--transition-medium), color var(--transition-medium);
    min-width: 1200px; /* 设置最小宽度，防止布局压缩 */
}

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    min-width: 1200px; /* 确保容器有最小宽度 */
}

/* 顶部工具栏 */
.toolbar {
    background: linear-gradient(135deg, var(--toolbar-primary) 0%, var(--toolbar-secondary) 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px var(--shadow-medium);
    z-index: 1000;
    transition: background var(--transition-medium);
}

.toolbar h1 {
    font-size: 24px;
    font-weight: 600;
    margin: 0;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.toolbar-logo {
    height: 40px;
    width: auto;
    object-fit: contain;
}

.toolbar-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* 主题切换按钮 */
.btn-theme {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
}

.btn-theme:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.theme-icon {
    font-size: 16px;
    transition: transform var(--transition-fast);
}

/* 移除重复的主题图标规则 */

/* 主要内容区域 */
.main-content {
    display: flex;
    flex: 1;
    min-height: 0;
}

/* 左侧算子面板 */
.operator-panel {
    width: 280px;
    min-width: 280px; /* 固定最小宽度 */
    max-width: 280px; /* 固定最大宽度 */
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 20px;
    overflow-y: auto;
    box-shadow: 2px 0 10px var(--shadow-light);
    transition: background-color var(--transition-medium), border-color var(--transition-medium);
    flex-shrink: 0; /* 防止收缩 */
}

.operator-panel h3 {
    margin-bottom: 20px;
    color: var(--text-secondary);
    font-size: 18px;
    font-weight: 600;
}

.operator-category {
    margin-bottom: 25px;
}

.operator-category h4 {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.operator-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.operator-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: grab;
    transition: all var(--transition-fast);
    user-select: none;
}

.operator-item:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 166, 81, 0.2);
}

.operator-item:active {
    cursor: grabbing;
    transform: translateY(0);
}

.operator-icon {
    font-size: 20px;
    margin-right: 10px;
    width: 30px;
    text-align: center;
}

.operator-item span {
    font-size: 14px;
    font-weight: 500;
    color: inherit;
    transition: color var(--transition-fast);
}

/* 工作流画布 */
.workflow-canvas {
    flex: 1;
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    position: relative;
    min-width: 600px; /* 设置最小宽度，确保画布不会被过度压缩 */
    transition: background-color var(--transition-medium);
}

.canvas-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-tertiary);
    transition: all var(--transition-medium);
}

.canvas-header h3 {
    font-size: 16px;
    color: var(--text-secondary);
    font-weight: 600;
}

.canvas-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* 缩放显示 */
.zoom-display {
    font-size: 12px;
    color: var(--text-muted);
    padding: 4px 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    min-width: 50px;
    text-align: center;
    transition: all var(--transition-fast);
}

.canvas {
    flex: 1;
    position: relative;
    background: 
        radial-gradient(circle, var(--grid-color) 1px, transparent 1px);
    background-size: 20px 20px;
    background-position: 0 0;
    overflow: hidden;
    min-height: 400px;
    transition: background var(--transition-medium);
    /* 支持缩放和平移 */
    transform-origin: 0 0;
    cursor: grab;
}

.canvas:active {
    cursor: grabbing;
}

/* 画布边界虚线框 */
.canvas-boundary {
    position: absolute;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    pointer-events: none;
    z-index: 1;
    opacity: 0.6;
    transition: border-color var(--transition-medium);
}

/* 数据流动特效层 */
.data-flow-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
    overflow: hidden;
}

/* 数据流动粒子 */
.data-particle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--accent-primary);
    border-radius: 50%;
    opacity: 0.8;
    box-shadow: 0 0 10px var(--accent-primary);
    animation: dataFlow 3s linear infinite;
}

.data-particle.active {
    background: #ff6b6b;
    box-shadow: 0 0 15px #ff6b6b;
    animation-duration: 2s;
}

@keyframes dataFlow {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }
    10% {
        opacity: 0.8;
        transform: scale(1);
    }
    90% {
        opacity: 0.8;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0.5);
    }
}

/* 数据流动路径特效 */
@keyframes pathGlow {
    0%, 100% {
        filter: drop-shadow(0 0 3px var(--connection-color));
    }
    50% {
        filter: drop-shadow(0 0 8px var(--connection-color));
    }
}

.connections-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.drop-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--text-hint);
    font-size: 16px;
    text-align: center;
    pointer-events: none;
    z-index: 0;
    transition: color var(--transition-medium);
}

/* SVG 连接线在主题切换时平滑过渡颜色/粗细 */
svg .connection-line {
    stroke: var(--connection-color);
    stroke-width: 3;
    fill: none;
    transition: stroke var(--transition-medium), stroke-width var(--transition-medium);
}

/* 工作流节点 */
.workflow-node {
    position: absolute;
    background: var(--bg-secondary);
    border: 2px solid var(--connection-color);
    border-radius: 8px;
    padding: 12px;
    /* 固定节点尺寸，确保端口与连线定位一致 */
    width: 150px;
    height: 75px;
    cursor: move;
    z-index: 10;
    user-select: none;
    /* 主题切换时平滑过渡 */
    transition: background-color var(--transition-medium), border-color var(--transition-medium), box-shadow var(--transition-medium), color var(--transition-medium);
}

.workflow-node:hover {
    box-shadow: 0 6px 20px var(--shadow-heavy);
    transform: translateY(-2px);
}

.workflow-node.selected {
    border-color: #e74c3c;
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.3);
}

.workflow-node.dragging {
    opacity: 0.9;
    z-index: 1000;
    /* 移除所有GPU加速属性，实现真正零延迟 */
}

.workflow-node.processing {
    border-color: var(--accent-primary);
    animation: nodeProcessing 2s ease-in-out infinite;
}

@keyframes nodeProcessing {
    0%, 100% {
        box-shadow: 0 4px 12px var(--shadow-medium);
    }
    50% {
        box-shadow: 0 6px 20px var(--accent-primary), 0 0 20px rgba(0, 166, 81, 0.4);
    }
}

.node-header {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    margin-bottom: 10px;
    padding-right: 15px; /* 为右上角的删除按钮留出空间 */
}

.node-title {
    display: flex;
    align-items: center;
    font-weight: 600;
    color: var(--text-secondary);
    transition: color var(--transition-medium);
}

.node-icon {
    font-size: 18px;
    margin-right: 8px;
}

.node-delete {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 20;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.node-delete:hover {
    background: #c0392b;
    transform: scale(1.1);
}

.node-content {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
    transition: color var(--transition-medium);
}

.node-ports {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
}

.port {
    position: absolute;
    width: 0;
    height: 0;
    cursor: pointer;
    transition: all 0.2s ease;
    pointer-events: all;
    z-index: 20;
}

.port:hover {
    transform: translateY(-50%) scale(1.2);
}

.port.input:hover {
    border-left-color: #27ae60; /* 悬停时颜色变深 */
}

.port.output:hover {
    border-left-color: #d35400; /* 悬停时颜色变深 */
}

.port.input {
    /* 向右的三角形，指向节点内部 */
    border-left: 8px solid #2ecc71;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
}

.port.output {
    /* 向右的三角形，指向节点外部 */
    border-left: 8px solid #e67e22;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
}

/* 禁用态：端点已被占用时 */
.port.forbidden {
    cursor: not-allowed !important;
}
.port.input.forbidden {
    border-left-color: #e74c3c; /* 红色提示不可接入 */
}
.port.output.forbidden {
    border-left-color: #e74c3c; /* 红色提示不可接出 */
}

.port.connecting {
    animation: pulseTriangle 1s infinite;
}

@keyframes pulseTriangle {
    0%, 100% { transform: translateY(-50%) scale(1); }
    50% { transform: translateY(-50%) scale(1.3); }
}

/* 右侧参数面板 */
.parameter-panel {
    width: 320px;
    min-width: 320px; /* 固定最小宽度 */
    max-width: 320px; /* 固定最大宽度 */
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    padding: 20px;
    overflow-y: auto;
    box-shadow: -2px 0 10px var(--shadow-light);
    /* 避免宽度变化参与过渡，减少拖拽延迟 */
    transition: background-color var(--transition-medium), border-color var(--transition-medium), box-shadow var(--transition-medium);
    flex-shrink: 0; /* 防止收缩 */
}

.parameter-panel h3 {
    margin-bottom: 20px;
    color: var(--text-secondary);
    font-size: 18px;
    font-weight: 600;
}

.no-selection {
    text-align: center;
    color: var(--text-hint);
    font-style: italic;
    margin-top: 50px;
}

/* 参数表单 */
.parameter-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 14px;
    transition: color var(--transition-medium);
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 10px 12px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(0, 166, 81, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 60px;
}

/* 参数面板专用样式 */
.parameter-panel .checkbox-group {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.parameter-panel .checkbox-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-tertiary);
    transition: all 0.3s ease;
}

.parameter-panel .checkbox-item:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-primary);
    box-shadow: 0 2px 8px rgba(0, 166, 81, 0.1);
}

.parameter-panel .checkbox-item-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.parameter-panel .checkbox-item label {
    margin: 0;
    cursor: pointer;
    flex: 1;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 14px;
    transition: color var(--transition-medium);
}

.parameter-panel .checkbox-item-description {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
    margin-left: 8px;
    padding-left: 8px;
    border-left: 2px solid var(--border-color);
    transition: all var(--transition-medium);
}

/* 邮储绿色滑块开关样式 */
.switch {
    position: relative !important;
    display: inline-block !important;
    width: 40px !important;
    height: 20px !important;
    flex-shrink: 0 !important;
    min-width: 40px !important;
    max-width: 40px !important;
}

.switch input {
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
}

.slider {
    position: absolute !important;
    cursor: pointer !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background-color: #ccc !important;
    transition: .3s !important;
    border-radius: 20px !important;
    width: 40px !important;
    height: 20px !important;
}

.slider:before {
    position: absolute !important;
    content: "" !important;
    height: 16px !important;
    width: 16px !important;
    left: 2px !important;
    top: 2px !important;
    background-color: white !important;
    transition: .3s !important;
    border-radius: 50% !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2) !important;
}

input:checked + .slider {
    background: linear-gradient(135deg, #00a651 0%, #007a3d 100%) !important;
}

input:focus + .slider {
    box-shadow: 0 0 0 2px rgba(0, 166, 81, 0.3) !important;
}

input:checked + .slider:before {
    transform: translateX(20px) !important;
}

/* 数值输入框改进样式 */
.parameter-panel .form-group input[type="number"] {
    border: 2px solid var(--border-color);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 14px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.parameter-panel .form-group input[type="number"]:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(0, 166, 81, 0.1);
}

/* 文本输入框样式 */
.parameter-panel .form-group input[type="text"] {
    border: 2px solid var(--border-color);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 14px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: all var(--transition-fast);
    width: 100%;
}

.parameter-panel .form-group input[type="text"]:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(0, 166, 81, 0.1);
}

/* 选择框样式 */
.parameter-panel .form-group select {
    border: 2px solid var(--border-color);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 14px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: all var(--transition-fast);
    width: 100%;
}

.parameter-panel .form-group select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(0, 166, 81, 0.1);
}

/* 子参数容器样式 */
.sub-params {
    margin-top: 12px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-tertiary);
    transition: all var(--transition-medium);
}

.sub-params .form-group {
    margin-bottom: 12px;
}

.sub-params .form-group:last-child {
    margin-bottom: 0;
}

.sub-params .form-group label {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 6px;
    transition: color var(--transition-medium);
}

.sub-params .form-group input,
.sub-params .form-group select {
    border: 2px solid var(--border-color);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 14px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: all var(--transition-fast);
    width: 100%;
}

.sub-params .form-group input:focus,
.sub-params .form-group select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(0, 166, 81, 0.1);
}

.file-input-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.file-input-group input {
    flex: 1;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.file-input-group input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(0, 166, 81, 0.1);
}

/* 按钮样式 */
.btn {
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition-fast);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--shadow-heavy);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--connection-color);
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-secondary {
    background: var(--text-muted);
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-file {
    background: #f39c12;
    color: white;
}

.btn-file:hover {
    background: #d68910;
}

/* 底部状态栏 */
.status-bar {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    border-top: 1px solid var(--border-color);
    transition: all var(--transition-medium);
}

.status-info {
    display: flex;
    gap: 20px;
}

.status-info span {
    padding: 4px 8px;
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
    transition: background var(--transition-fast);
}

[data-theme="dark"] .status-info span {
    background: rgba(255,255,255,0.1);
}

[data-theme="light"] .status-info span {
    background: rgba(0,0,0,0.1);
}

/* 日志面板 */
.log-panel {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    height: 200px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: all var(--transition-medium);
}

.log-panel.hidden {
    height: 0;
    overflow: hidden;
}

.log-header {
    padding: 10px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-secondary);
    transition: all var(--transition-medium);
}

.log-header h4 {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

.log-content {
    flex: 1;
    padding: 15px 20px;
    overflow-y: auto;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 12px;
    line-height: 1.4;
    background: var(--bg-tertiary);
    transition: background var(--transition-medium);
}

.log-entry {
    margin-bottom: 8px;
    padding: 4px 0;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    transition: all var(--transition-medium);
}

.log-entry.info {
    color: var(--connection-color);
}

.log-entry.success {
    color: var(--accent-primary);
}

.log-entry.warning {
    color: #f39c12;
}

.log-entry.error {
    color: #e74c3c;
}

/* 上下文菜单 */
.context-menu {
    position: fixed;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 4px 20px var(--shadow-heavy);
    z-index: 2000;
    min-width: 120px;
    overflow: hidden;
    transition: all var(--transition-fast);
}

.context-menu.hidden {
    display: none;
}

.menu-item {
    padding: 10px 15px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-primary);
    transition: all var(--transition-fast);
    border-bottom: 1px solid var(--border-color);
}

.menu-item:last-child {
    border-bottom: none;
}

.menu-item:hover {
    background: var(--bg-tertiary);
}

.menu-item[data-action="delete"] {
    color: #e74c3c;
}

.menu-item[data-action="delete"]:hover {
    background: rgba(231, 76, 60, 0.1);
}

/* 模态框 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: 10px;
    min-width: 400px;
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 10px 40px var(--shadow-heavy);
    transition: background var(--transition-medium);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-tertiary);
    transition: all var(--transition-medium);
}

.modal-header h4 {
    margin: 0;
    font-size: 18px;
    color: var(--text-secondary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: #e74c3c;
    color: white;
}

.modal-body {
    padding: 20px;
    background: var(--bg-secondary);
    transition: background var(--transition-medium);
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    background: var(--bg-tertiary);
    transition: all var(--transition-medium);
}

.file-info {
    margin-top: 15px;
    padding: 15px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-muted);
    transition: all var(--transition-medium);
}

/* 连线样式 */
.connection-line {
    stroke: var(--connection-color);
    stroke-width: 2;
    fill: none;
    transition: stroke var(--transition-fast);
}

.connection-line.selected {
    stroke: #e74c3c;
    stroke-width: 3;
}

.connection-line.temp {
    stroke: var(--text-muted);
    stroke-dasharray: 5,5;
}

.connection-line.active {
    stroke: var(--accent-primary);
    stroke-width: 3;
    animation: pathGlow 2s ease-in-out infinite;
}



/* 固定布局设计 - 不响应窗口大小变化 */
/* 移除了响应式媒体查询，保持固定布局 */

/* 加载动画 */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #3498db;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s infinite linear;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 拖拽状态 */
.drag-over {
    background: rgba(0, 166, 81, 0.1);
    border: 2px dashed var(--accent-primary);
    transition: all var(--transition-fast);
}

.drag-over .drop-hint {
    color: var(--accent-primary);
    font-weight: 600;
    transform: translate(-50%, -50%) scale(1.1);
}

.dragging-operator {
    opacity: 0.8;
    transform: scale(0.95);
    transition: all var(--transition-fast);
    cursor: grabbing;
}

.dragging-operator:active {
    opacity: 0.6;
}

/* 节点类型特定样式 */
.workflow-node.input {
    border-color: #2ecc71;
}

.workflow-node.output {
    border-color: #e67e22;
}

.workflow-node.character-cleaner {
    border-color: #9b59b6;
}

.workflow-node.sentence-cleaner {
    border-color: #1abc9c;
}

/* 工具提示 */
.tooltip {
    position: absolute;
    background: #2c3e50;
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    z-index: 4000;
    pointer-events: none;
    white-space: nowrap;
}

.tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #2c3e50 transparent transparent transparent;
}

/* 文档浮窗样式 */
.doc-tooltip {
    position: fixed;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 350px;
    max-height: 80vh;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 8px 32px var(--shadow-heavy);
    z-index: 5000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-medium);
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.doc-tooltip.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(0);
}

.doc-tooltip-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    border-radius: 12px 12px 0 0;
}

.doc-tooltip-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}



.doc-tooltip-content {
    padding: 20px;
    max-height: calc(80vh - 80px);
    overflow-y: auto;
}

.doc-tooltip-description {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.5;
}

.doc-tooltip-details {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
    line-height: 1.6;
    background: var(--bg-tertiary);
    padding: 12px;
    border-radius: 8px;
    border-left: 4px solid var(--accent-primary);
}

.doc-tooltip-example {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 12px;
    color: var(--text-secondary);
    white-space: pre-wrap;
    overflow-x: auto;
}

.doc-tooltip-example-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
}

.doc-tooltip-example-title::before {
    content: '💡';
    margin-right: 6px;
}

/* 滚动条样式 */
.doc-tooltip-content::-webkit-scrollbar {
    width: 6px;
}

.doc-tooltip-content::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 3px;
}

.doc-tooltip-content::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.doc-tooltip-content::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* 悬停效果增强 */
.checkbox-item[data-doc-key] {
    transition: all var(--transition-fast);
    cursor: help;
}

.checkbox-item[data-doc-key]:hover {
    background-color: var(--bg-tertiary);
    border-radius: 8px;
    transform: translateX(2px);
    box-shadow: 0 2px 8px var(--shadow-light);
}

/* 预置工作流模块 */
.preset-workflows {
    margin-top: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
    transition: background-color var(--transition-medium), border-color var(--transition-medium);
}

.preset-header h3 {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 10px;
    transition: color var(--transition-medium);
}

/* 新增：标题区内的左右滚动按钮与布局 */
.preset-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.preset-controls {
    display: flex;
    gap: 8px;
}

.preset-scroll-btn {
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 2px 8px var(--shadow-light);
    /* 4:3视觉比例参数 */
    min-width: 240px;
    height: 180px;
}

.preset-scroll-btn:hover {
    border-color: var(--accent-primary);
    background: var(--bg-secondary);
}

.preset-list {
    display: flex;
    gap: 12px;
    align-items: flex-start; /* 统一顶部对齐，减少卡片高度占用 */
    overflow-x: auto;
    padding-top: 2px; /* 增加顶部内边距，避免卡片上边框被遮挡 */
    margin-top: 6px; /* 与标题行拉开距离 */
    padding-bottom: 4px;
    scroll-behavior: smooth; /* 平滑滚动 */
    background-color: transparent;
    border-color: var(--border-color);
    transition: background-color var(--transition-medium), border-color var(--transition-medium);
}

/* 可选：隐藏默认滚动条（保留鼠标滚轮功能） */
.preset-list::-webkit-scrollbar {
    height: 8px;
}
.preset-list::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 4px;
}

.preset-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 8px 10px; /* 降低高度 */
    display: grid; /* 改为网格便于控制垂直布局 */
    grid-template-columns: 24px 1fr; /* 左侧图标，右侧内容 */
    grid-template-rows: auto 1fr; /* 标题占用一行，下面留空以保证比例 */
    row-gap: 6px;
    transition: background-color var(--transition-medium), border-color var(--transition-medium), box-shadow var(--transition-medium), color var(--transition-medium);
}

.preset-item:hover {
    border-color: var(--accent-primary);
    box-shadow: 0 4px 12px rgba(0, 166, 81, 0.2);
    background-color: var(--bg-secondary);
    transition: background-color var(--transition-medium), border-color var(--transition-medium), box-shadow var(--transition-medium);
    /* 移除上移效果，避免上侧边框被遮挡 */
}

.preset-item .preset-icon {
    font-size: 20px;
    width: 28px;
    text-align: center;
    color: var(--text-secondary);
    transition: color var(--transition-medium);
}

.preset-item .preset-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color var(--transition-medium);
}

.preset-item .preset-desc {
    display: none !important; /* 仅保留标题，隐藏灰色注释 */
}

/* 悬停文档提示 */
.preset-item[data-doc-key] {
    cursor: help;
}